package com.maimeng.Controllers;


import com.maimeng.Mapper.UserMapper;
import com.maimeng.Model.User;
import com.maimeng.Services.CacheService;
import com.maimeng.Services.CacheServiceX;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class UserController {

    @Autowired
    CacheService cacheService;

    @Autowired
    UserMapper userMapper;
    @Autowired
    CacheServiceX cacheServiceX;
    @RequestMapping(value = "/users",method = RequestMethod.GET)
    public User[] setUser()
    {

        return userMapper.userAll();


        //return cacheServiceX.getCache("show");
    }

    @RequestMapping(value = "/getUserInfo/{uid:\\d+}",method = RequestMethod.GET)

    public User getUserInfo(@PathVariable("uid") Long userId)
    {
        return userMapper.selectByPrimaryKey(userId);
    }

}
